﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThreeDPrinting.ORM;
using System.Collections;

namespace ThreeDPrinting.Entity
{
    //Sealed to stop unwelcome dependencies
    public sealed class ShoppingCart
    {
        //Singleton is a design pattern
        //Only one object can be created
        private static ShoppingCart instance;

        //Private Data Members
        private int Index { get; set; }
        private string ItemCode { get; set; }
        private int Quantity { get; set; }

        //Construtor set to private
        //Prevents outside instantiation
        private ShoppingCart() { }


        //Instantiation does not occur until the class is called - Lazy Loading
        public static ShoppingCart SetShoppingCart(string _ItemCode)
        {
            if (instance == null)
            {
                instance = new ShoppingCart();
                instance.ItemCode = _ItemCode;
            }
            return instance;
        }
        
        private DBEntities entities = new DBEntities();


        //public List<productsCatalog> GetShoppingCart()
        //{
        //        int CartItemID = Convert.ToInt32(instance.ItemCode);
        //        return entities.productsCatalogs.Where(
        //            c => c.productId == CartItemID).ToList();
        //}
    }   
}